package com.mdd.common.enums;

/**
 * 网站类型
 */
public enum WebTypeEnum {

    SHOP_SYS(0, "商城系统"),
    MEAL_SYS(1, "点餐系统"),
    JIAZ_SYS(2, "家政系统"),
    TCITY_SYS(3, "同城发布")
    ;

    /**
     * 构造方法
     */
    private final int code;
    private final String msg;
    WebTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 获取状态码
     *
     * @author fzr
     * @return Long
     */
    public int getCode() {
        return this.code;
    }

    /**
     * 获取提示
     *
     * @author fzr
     * @return String
     */
    public String getMsg() {
        return this.msg;
    }

    /**
     * 根据编码获取Msg
     *
     * @author fzr
     * @param code 类型
     * @return String
     */
    public static String getMsgByCode(Integer code){
        for(WebTypeEnum enumItem: WebTypeEnum.values()) {
            if (enumItem.getCode() == code) {
                return enumItem.getMsg();
            }
        }
        return null;
    }

}
